

from selenium import webdriver
from configparser import ConfigParser
import time

cfg = ConfigParser()
r = cfg.read('password.ini')
password = cfg.get('password', 'password')

driver = webdriver.Chrome()

driver.get('https://mail.qq.com/')

login_frame = driver.find_element_by_id('login_frame')

driver.switch_to.frame(login_frame)

driver.find_element_by_id('switcher_plogin').click()

driver.find_element_by_id('u').send_keys('2705185834')
driver.find_element_by_id('p').send_keys(password)
driver.find_element_by_id('login_button').click()

time.sleep(2)
driver.find_element_by_id('readmailbtn_link').click()

mainFrame = driver.find_element_by_id('mainFrame')
driver.switch_to.frame(mainFrame)

emails = driver.find_elements_by_css_selector('.toarea .F, .toarea .M')

for email in emails:
    print(email)


